import { Model } from 'pinia-orm';
import { Attr, Str, Uid, Num, Bool, HasOne, HasMany, BelongsTo, HasManyBy, BelongsToMany, MorphOne,
  MorphTo, MorphMany, MorphToMany, OnDelete
  } from 'pinia-orm/decorators';
import { useAxiosRepo } from '@pinia-orm/axios';
import { useAppConfig } from '@vben/hooks';
import type { MinishopOrderExpress, MinishopOrderExpressResponse } from '../../views/uctoo/minishop_order_express/types.js';
//#region Human-Code Preservation

//#endregion Human-Code Preservation

const { apiURL } = useAppConfig(import.meta.env, import.meta.env.PROD);

export class uctoo_minishop_order_express extends Model {
  static override entity = 'uctoo_minishop_order_express'

@Uid() declare id: string 
@Uid() declare user_id: string 
@Uid() declare order_id: string 
@Str('') declare express_name: string 
@Str('') declare express_code: string 
@Str('') declare express_no: string 
@Uid() declare creator: string | null
@Attr('') declare created_at: string 
@Attr('') declare updated_at: string 
@Attr('') declare deleted_at: string | null


  static override config = {
    axiosApi: {
        actions: {
            getuctooMinishopOrderExpressList(page: number, pageSize: number, searchParams?: any){
                return useAxiosRepo(uctoo_minishop_order_express).api().get(`/uctoo/minishop_order_express/${pageSize}/${page}`, {
                  params: searchParams,
                  headers: { 'Content-Type': 'application/json;charset=utf-8',
                          'Authorization': `Bearer ${localStorage.getItem('accessToken')}` 
                  },
                  baseURL: apiURL,
                  dataKey: 'minishopOrderExpresss'
                })
            },
            getuctooMinishopOrderExpress(id: string){
              return useAxiosRepo(uctoo_minishop_order_express).api().get(`/uctoo/minishop_order_express/${id}`, {
                headers: { 'Content-Type': 'application/json;charset=utf-8',
                        'Authorization': `Bearer ${localStorage.getItem('accessToken')}` 
                },
                baseURL: apiURL,
              })
            },
            adductooMinishopOrderExpress(data: Partial<MinishopOrderExpress>){
              return useAxiosRepo(uctoo_minishop_order_express).api().post('/uctoo/minishop_order_express/add', data, {
                headers: { 'Content-Type': 'application/json;charset=utf-8',
                        'Authorization': `Bearer ${localStorage.getItem('accessToken')}` 
                },
                baseURL: apiURL,
              })
            },
            edituctooMinishopOrderExpress(data: any){
              return useAxiosRepo(uctoo_minishop_order_express).api().post('/uctoo/minishop_order_express/edit', data, {
                headers: { 'Content-Type': 'application/json;charset=utf-8',
                        'Authorization': `Bearer ${localStorage.getItem('accessToken')}` 
                },
                baseURL: apiURL,
              })
            },
            deleteuctooMinishopOrderExpress(data: any){
              return useAxiosRepo(uctoo_minishop_order_express).api().post('/uctoo/minishop_order_express/del', data, {
                headers: { 'Content-Type': 'application/json;charset=utf-8',
                        'Authorization': `Bearer ${localStorage.getItem('accessToken')}` 
                },
                baseURL: apiURL,
              })
            },

//#region Human-Code Preservation

//#endregion Human-Code Preservation
        } 
    }
  }
}
